home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / slangtab.h < prev    next >
C/C++ Source or Header  |  1994-10-29  |  3KB  |  92 lines

  1. #ifndef __SLANG_TABLE_H_
  2. #define __SLANG_TABLE_H_
  3.  
  4. enum { DELIMITER = 1,     // '\0'(end),/*,*/,\r,<>=,' ',+-^/*%=;(),<>[]
  5.        VARIABLE,          // Symbolic name of variable, like x, k1 and so on
  6.        NUMBER,            // Double value
  7.        COMMAND,           // See "commands TABLE[]" later in this file
  8.        STRING,            // Remarked blocks or quoted text
  9.        QUOTE,             // Quote
  10.        ALPHA };           // @ (gosub) or ! (label) symbol
  11.  
  12.  
  13. enum { IF = 1, THEN, FOR, NEXT, TO, GOTO, EOL, DELETE,
  14.        FINISHED, GOSUB, LABEL, PLAYEX, RETURN, END, REMARK,
  15.        REMARK_BLOCK,
  16.        SIN, COS, TAN, ASIN, ACOS, ATAN, ABS, EXP, LOG, LG,
  17.        PRINT, INPUT, PAUSE,
  18.  
  19.        USER
  20. #include "user1.inc"
  21.        };  // All functions after this are user-defined in Slang childs
  22.  
  23. struct commands
  24.     {
  25.     char command[20];
  26.     char tok;
  27.     };
  28.  
  29. static commands TABLE[] =  {
  30.         { "if",     IF       },
  31.         { "then",   THEN     },
  32.         { "delete", DELETE   },
  33.         { "for",    FOR      },
  34.         { "next",   NEXT     },
  35.         { "to",     TO       },
  36.         { "@",      GOSUB    },
  37.         { "goto",   GOTO     },
  38.         { "!",      LABEL    },
  39.         { "return", RETURN   },
  40.         { "end",    END      },
  41.         { "&", REMARK   },
  42.         { "/*", REMARK_BLOCK },
  43.         { "play",   PLAYEX     },
  44.         { "sin",    SIN      },
  45.         { "cos",    COS      },
  46.         { "lg",     LG       },
  47.  
  48.         { "print",  PRINT    },
  49.         { "input",  INPUT    },
  50.         { "pause", PAUSE     },
  51.  
  52. /* The following trick could be used to expand this list of SLANG functions
  53.    and add user-defined ones, which are used by Slang child classes.
  54. */
  55. #include "userlang.inc"
  56.  
  57.         { "",       END      }     // Marker of end of the table
  58.         };
  59.  
  60.  
  61. static char* error_string[] =
  62.     {
  63.     "Syntax error",                            //  0
  64.     "Symbol '(' or ')' expected",              //  1
  65.     "Not an expression",                       //  2
  66.     "Symbol '=' expected",                     //  3
  67.     "Not a variable",                          //  4
  68.     "Too many subroutines",                    //  5
  69.     "Duplicated subroutines",                  //  6
  70.     "Undefined subroutine",                    //  7
  71.     "Expected THEN operator",                  //  8
  72.     "Expected TO operator",                    //  9
  73.     "Number of nested FOR cycles too big",     //  10
  74.     "NEXT without FOR",                        //  11
  75.     "Number of nested GOSUB calls too big",    //  12
  76.     "RETURN without GOSUB",                    //  13
  77.     "Quote expected",               //  14
  78.     "Wrong arguments number",                  //  15
  79.     "Out of range",                            //  16
  80.     "It is no file",                           //  17
  81.     "Symbol '=' or ARRAY expected",            //  18
  82.     "Symbol '[' or ']' expected",              //  19
  83.     "Name is already used ",                   //  20
  84.     "File error",                              //  21
  85.     "Memory allocation error",                 //  22
  86.     "User break",                              //  23
  87.     "USER ERROR"
  88.     };
  89.  
  90.  
  91.  
  92. #endif __SLANG_TABLE_H_